package com.jwater.launch;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:启动类信息和依赖的安装包信息
 * @author: jnner
 * @createDate: 2021/2/5
 * @version: 1.0
 */
public class LauncherInfo {
    private String className;
    private String[] args = new String[]{};
    private List<DependDeployInfo> dependDeployInfos = new ArrayList<DependDeployInfo>();

    private LauncherInfo(String className) {
        this.className = className;
    }

    public static LauncherInfo build(String className) {
        return new LauncherInfo(className);
    }

    public LauncherInfo setArgs(String[] args) {
        this.args = args;
        return this;
    }

    public LauncherInfo addDeployInfo(String regionName, String deployName, Long version) {
        DependDeployInfo dependDeployInfo = new DependDeployInfo();
        dependDeployInfo.setRegionName(regionName);
        dependDeployInfo.setDeployName(deployName);
        dependDeployInfo.setVersion(version);
        dependDeployInfos.add(dependDeployInfo);
        return this;
    }

    public String getClassName() {
        return className;
    }

    public String[] getArgs() {
        return args;
    }

    public List<DependDeployInfo> getDelpoyInfo() {
        return dependDeployInfos;
    }

    public class DependDeployInfo {
        private String regionName;
        private String deployName;
        private Long version;

        public String getRegionName() {
            return regionName;
        }

        public void setRegionName(String regionName) {
            this.regionName = regionName;
        }

        public String getDeployName() {
            return deployName;
        }

        public void setDeployName(String deployName) {
            this.deployName = deployName;
        }

        public Long getVersion() {
            return version;
        }

        public void setVersion(Long version) {
            this.version = version;
        }
    }
}
